<template>
	<!-- 商家核销订单 -->
	<view class="exchangeorderr_wp">
		<view class="e_nav">
			<view :class="{'e_nav_active':active==0}" @click="navTap(0)">全部</view>
			<view :class="{'e_nav_active':active==1}" @click="navTap(1)">待核销</view>
			<!-- <view :class="{'e_nav_active':active==1}" @click="navTap(1)">待兑换</view> -->
			<view :class="{'e_nav_active':active==3}" @click="navTap(3)">已核销</view>
			<view :class="{'e_nav_active':active==4}" @click="navTap(4)">售后</view>
		</view>
		<view class="e_list">
			<view class="e_item" v-for="item in list" :key="item.id">
				<view class="e_itee_head">
					<view>订单编号：{{item.ordersn}}</view>
					<view>{{item.statusName}}</view>
				</view>
				<view class="e_itee_body" v-for="iitem in item.goodsList" :key="iitem.id">
					<image :src="iitem.thumb" mode=""></image>
					<view class="e_itee_name">
						<view class="e_itee_title">{{iitem.goodstitle}}</view>
						<view class="e_itee_price">共{{iitem.total}}份</view>
						<view class="e_itee_price"><text>实付￥{{iitem.realprice}}</text></view>
					</view>
				</view>
				<view class="e_itee_money" v-if="item.status==1">
					<view>支付时间：{{item.paytime}}</view>
					<text>预估到账：<text class="small">￥</text><text class="price">{{item.price}}</text></text>
				</view>
				<view class="e_itee_money" v-if="item.status==3">
					<view>支付时间：{{item.paytime}}</view>
					<text>实际到账：<text class="small">￥</text><text class="price">{{item.price}}</text></text>
				</view>
			</view>
		</view>
		<view class="loading_message">
			<image v-if="isloading" src="../../static/business/loading.gif" mode=""></image>
			<text v-if="isempty">到底了~</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				uid: '',
				active: 0,
				list: [],
				page: 0,
				isloading: false,
				isempty: false,
			}
		},
		onReachBottom() {
			this.getList();
		},
		onLoad(option) {
			this.uid = option.uid;
			this.getList();
		},
		methods: {
			getList() {
				this.page += 1;
				this.isloading = true;
				this.$axios('groupManager/changeOrder', 'POST', 'supplier', {
					page: this.page,
					status: this.active,
					uid: this.uid,
				}).then(res => {
					this.isloading = false;
					if (res.data.code == 200) {
						let length = res.data.data.list.length;
						this.list = this.list.concat(res.data.data.list);
						this.isempty = length <= 0 ? true : false;
					}
				})
			},
			navTap(e) {
				if (this.active == e) return;
				this.active = e;
				this.page = 0;
				this.list = [];
				this.isempty = false;
				this.getList();
			}
		}
	}
</script>

<style lang="scss">
	page {
		color: $font-color-dark;
		padding-bottom: 130upx;
		background: #FBF8FE;
	}

	.e_nav {
		background-color: #fff;
		display: flex;
		align-items: center;
		line-height: 80rpx;
		position: fixed;
		width: 100%;
		z-index: 100;
	}

	.e_nav view {
		flex: 1;
		text-align: center;
		font-size: $font-base;
		position: relative;
	}

	.e_nav_active:after {
		content: '';
		height: 6rpx;
		background: #8615E1;
		border-radius: 6rpx;
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
		bottom: 0;
		width: 28rpx;
	}

	.e_list {
		padding-top: 80rpx;
		overflow: hidden;
	}

	.e_item {
		background-color: #fff;
		border-radius: 10upx;
		margin: 20upx 20upx 0;
		padding: 20upx;

	}

	.e_itee_head,
	.e_itee_body,
	.e_itee_price {
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 24rpx;
		color: #333333;
	}

	.e_itee_head view:nth-of-type(2) {
		color: #8615E1;
		font-weight: 600;
	}

	.e_itee_body {
		align-items: flex-start;
		padding: 20rpx 0 0;
	}

	.e_itee_body image {
		border-radius: 10upx;
		width: 140upx;
		height: 140upx;
	}

	.e_itee_name {
		flex: 1;
		padding: 12rpx 0;
		padding-left: 20rpx;
		line-height: 38rpx;
	}

	.e_itee_title {
		overflow: hidden;
		font-size: 28rpx;
		color: #333333;
		font-weight: bold;
		margin-bottom: 8rpx;
	}

	.e_itee_price {
		font-size: 24rpx;
		color: #999999;
		text{
			color: #8615E1;
		}
	}

	.e_itee_money {
		text-align: right;
		font-size: 24rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.price{
			color: #BF000E;
			font-weight: 600;
			font-size: 28rpx;
		}
		.small{
			color: #BF000E;
			font-size: 20rpx;
			font-weight: bold;
		}
	}
	.loading_message {
		color: #0062CC;
		padding: 20upx;
		text-align: center;
	}

	.loading_message image {
		height: 50upx;
		width: 50upx;
	}
</style>
